function  save() {
    var params = {};
    params['name']=$("#plaName").val();
    params['placedes']=$("#plaDes").val();
    params['hotticket']=Number($("#plaHotticket").val());
    params['dimticket']=Number($("#plaDimticket").val());
    params['provinceid']=Number($("#plaProvince").val());

    console.log(params)
    jQuery.post('/plaSave',params,function (res) {
        console.log(res);
        if (res.hasOwnProperty("msg1")){
            alert("景点已存在！");
        }else if (res.hasOwnProperty("msg2")){
            alert("请完善景点信息....");
        } else {
            console.log(params);
            jQuery.post('/plaSave',params,function (res) {
                console.log(res);
                $("#addPla").modal('hide');
                window.location.reload();
            },"json");
        }

    },"json");

}

function deletePla(id) {
    console.log(id);
    var params = {};
    params['id']=id;
    $.post('/plaDelete',params,function (res) {
        window.location.reload();
    },"json");

}

function editPla(pla) {
    console.log(pla);
    $("#plaId1").val(pla.id);
    $("#plaName1").val(pla.name);
    $("#plaDes1").val(pla.placedes);
    $("#plaHotticket1").val(pla.hotticket+"");
    $("#plaDimticket1").val(pla.dimticket+"");
    $("#plaProvince1").val(pla.provinceid+"");

    $("#updatePla").modal('show');
}

function  save1() {
    var params = {};
    params['id']=$("#plaId1").val();
    params['name']=$("#plaName1").val();
    params['placedes']=$("#plaDes1").val();
    params['hotticket']=Number($("#plaHotticket1").val());
    params['dimticket']=Number($("#plaDimticket1").val());
    params['provinceid']=Number($("#plaProvince1").val());

    jQuery.post('/plaUpdate',params,function (res) {
        console.log(res);
        if (res.hasOwnProperty("msg2")){
            alert("请完善信息....");
        } else {
            console.log(params);
            jQuery.post('/plaUpdate',params,function (res) {
                console.log(res);
                $("#updatePla").modal('hide');
                window.location.reload();
            },"json");
        }

    },"json");
}

function back(){
    window.location.href='province';
}
